package com.med.controller;

import com.med.entity.MedicineCategoryDO;
import com.med.service.IMedicineCategoryService;
import com.med.service.IMedicineService;
import com.med.vo.MedicineCategoryVO;
import com.ruoyi.common.core.domain.R;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/drugs/category")
public class    MedicineCategoryController {
    @Autowired
    private IMedicineCategoryService medicineCategoryService;
    @RequestMapping("/add")
    public R<String> addMeicineCategory(MedicineCategoryVO medicineCategoryVO){
        return medicineCategoryService.addMedicineCategory(medicineCategoryVO);
    }

    @RequestMapping("/list")
    public R<List<MedicineCategoryDO>> listAllMedicineCategory(MedicineCategoryVO medicineCategoryVO){
        return medicineCategoryService.queryMedicineCategory(medicineCategoryVO);
    }

    @RequestMapping("/update")
    public R<String> updateMedicineCategory(@RequestBody MedicineCategoryVO medicineCategoryVO){
        return medicineCategoryService.updateMedicineCategory(medicineCategoryVO);
    }

    @RequestMapping("/delete")
    public R<String> deleteMedicineCategory(@Param("medicineCategoryId") Integer medicineCategoryId){
        return medicineCategoryService.deletemedicineCategory(medicineCategoryId);
    }

}
